package model.domain;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "impediment", catalog = "scrum")
public class Impediment implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer impedimentID;
	private Person user;
	private Status status;
	private Project project;
	private String description;
	private String comments;
	private Date day;

	public Impediment() {
	}

	public Impediment(Status status, Project project,
			String cdescription, Date dtDay) {
		this.status = status;
		this.project = project;
		this.description = cdescription;
		this.day = dtDay;
	}

	public Impediment(Person user, Status status,
			Project project, String cdescription, String ccomments, Date dtDay) {
		this.user = user;
		this.status = status;
		this.project = project;
		this.description = cdescription;
		this.comments = ccomments;
		this.day = dtDay;
	}

	@Id
        @GeneratedValue(strategy = IDENTITY)
	@Column(name = "nImpedimentID", unique = true, nullable = false)
	public Integer getImpedimentID() {
		return this.impedimentID;
	}

	public void setImpedimentID(Integer impedimentID) {
		this.impedimentID = impedimentID;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "nReportedID")
	public Person getUser() {
		return this.user;
	}

	public void setUser(Person user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "nStatusID", nullable = false)
	public Status getStatus() {
		return this.status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "nProjectID", nullable = false)
	public Project getProject() {
		return this.project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	@Column(name = "cDescription", nullable = false, length = 50)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "cComments", length = 500)
	public String getComments() {
		return this.comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "dtDay", nullable = false, length = 19)
	public Date getDay() {
		return this.day;
	}

	public void setDay(Date day) {
		this.day = day;
	}

}
